import request from "@/util/request";

// page: params.page,
// size: params.size,
// login_name
export const getUserListByPage = (params: any) => {
  return request({
    url: "/api/user/getUserListByPage",
    method: "get",
    params: params,
  });
};

export const removeUser = (id: number) => {
  return request({
    url: "/api/user/remove",
    method: "get",
    params: {
      id,
    },
  });
};

export const editUser = (obj: any) => {
  return request({
    url: "/api/user/save",
    method: "post",
    data: obj,
  });
};

export const resetPassword = (obj: any) => {
  return request({
    url: "/api/user/resetPassword",
    method: "post",
    data: obj,
  });
};

export const userLogin = (obj: any) => {
  return request({
    url: "/api/user/userLogin",
    method: "post",
    data: {
      login_name: obj.loginName,
      password: obj.password,
    },
  });
};

export const userLogout = (token: string) => {
  return request({
    url: `/api/user/logout/${token}`,
    method: "get",
  });
};
